package com.ruoyi.web.controller.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Classname MPconfig
 * @Description
 * @Date 2025/5/23 15:21
 * @Created by 时光偷走初心
 */
@Configuration
public class MPConfig {
    //    拦截到select * from 表 自动拼接 limit
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor(){
//      创建mybatis拦截器
        MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
//      添加分页拦截器
        mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor());
//      将mybatisplus拦截器返回给ioc容器进行注入
        return mybatisPlusInterceptor;
    }
}